<template>
    <div style="width: 100%;height: 100%;position: relative">
        <Spin size="large" fix v-if="Loading"></Spin>
        <Form :label-width="180" ref="formValidate" :model="formValidate" id="form"
              :rules="ruleValidate">
            <table>
                <tr>
                    <td>
                        <Form-item label="入户调查日期:" prop="tpbl0010">
                            <DatePicker type="date" v-model="formValidate.tpbl0010" placeholder="请选择入户调查日期"
                                        :options="options"     style="width: 300px"  :editable="false"></DatePicker>
                        </Form-item>
                    </td>
                    <td>
                        <Form-item label="入户调查负责人:" prop="tpbl0011">
                            <Input v-model="formValidate.tpbl0011" placeholder="请输入入户调查负责人" style="width: 300px"/>
                        </Form-item>
                    </td>
                </tr>
                <tr>
                    <td>
                        <Form-item label="入户调查人员(两人以上):" prop="tpbl0005">
                            <Input v-model="formValidate.tpbl0005" placeholder="请输入入户调查人员" style="width: 300px"/>
                        </Form-item>
                    </td>
                    <td>
                        <Form-item label="是否与申请材料不一致或是否发生变化:" prop="tpbl0003">
                            <c-dict-select v-model="formValidate.tpbl0003" dictCode="yesorno" :width="300"/>
                        </Form-item>
                    </td>
                </tr>
                <tr>
                    <td>
                        <Form-item label="家庭基本经济状况:" prop="tpbl0002">
                            <c-text-area v-model="formValidate.tpbl0002" :max-length="100" :row="2" width="300"
                                         placeholder="请输入家庭基本经济状况"/>
                        </Form-item>
                    </td>
                    <td>
                        <Form-item label="变化情况说明:" prop="tpbl0004">
                            <c-text-area v-model="formValidate.tpbl0004" :max-length="100" :row="2" width="300"
                                         placeholder="请输入变化情况说明"/>
                        </Form-item>
                    </td>
                </tr>
                <tr>
                    <td>
                        <Form-item label="入户调查退回原因:" prop="tpbl0006">
                            <c-dict-select v-model="formValidate.tpbl0006" dictCode="reject_reason" :width="300" showKeys="01,05,06,999"/>

                        </Form-item>
                    </td>
                    <td>
                        <Form-item label="入户调查终止原因:" prop="tpbl0007">
                            <c-dict-select v-model="formValidate.tpbl0007" dictCode="terminate_reason" :width="300" showKeys="01,05,06,999"/>
                        </Form-item>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <Form-item label="办理意见说明:" prop="opmemo">
                            <c-text-area v-model="formValidate.opmemo" :max-length="100" :row="3" width="890"
                                         placeholder="请输入办理意见说明"/>

                        </Form-item>
                    </td>

                </tr>
            </table>
        </Form>
    </div>
</template>

<script>
    /**
     * 入户调查
     */
    import {CommonMixin} from '@/views/common/js/CommonMixin'

    export default {
        components: {},
        mixins: [CommonMixin],
        name: "handle01",
        data() {
            return {
                Loading: false,
                familyInfo: {},
                formValidate: {},
                disabled: true,
                information: "",
                ruleValidate: {
                    tpbl0010: [
                        {required: true, message: '入户调查日期不能为空!', trigger: 'change',pattern:/.+/}
                    ],
                    tpbl0011: [
                        {required: true, message: '入户调查负责人不能为空!', trigger: 'blur',}
                    ],
                    tpbl0005: [
                        {required: true, message: '入户调查人员不能为空!', trigger: 'blur',}
                    ],
                    tpbl0003: [
                        {required: true, message: '请选择!', trigger: 'change',}
                    ],
                    tpbl0002: [
                        {required: true, message: '家庭基本经济状况不能为空!', trigger: 'blur',}
                    ],
                    opmemo: [
                        {required: true, message: '办理意见说明不能为空!', trigger: 'blur',}
                    ],
                    tpbl0004: [
                        {required: false, message: '变化情况说明不能为空!', trigger: 'blur',}
                    ],
                    tpbl0006: [
                        {required: false, message: '退回原因不能为空!', trigger: 'change',}
                    ],
                    tpbl0007: [
                        {required: false, message: '终止原因不能为空!', trigger: 'change',}
                    ]
                },
                options: {
                    disabledDate(date) {
                        return date && date.valueOf() > Date.now();
                    }
                },
            }
        },
        methods: {
            check(name) {
                this.setRequired(name, this.ruleValidate);
                if (this.ruleValidate["tpbl0003"][0].required) {
                    if (this.formValidate.tpbl0003 == '1') {
                        this.ruleValidate["tpbl0004"][0].required = true;
                    } else {
                        this.ruleValidate["tpbl0004"][0].required = false;
                    }
                }

                var infor = false;
                this.$refs['formValidate'].validate((valid) => {
                    if (valid) {
                        infor = this.formValidate;
                    }
                })
                return infor;
            }
        }
    }
</script>

<style scoped src="../../../common/css/rightTip.css">


</style>
